package adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.netease.nimlib.sdk.avchat.AVChatManager;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;

import java.util.Collections;
import java.util.List;

import bean.ChatRoomMemberBean;
import bean.IMRoomMeberBean;
import student.andlei.com.student.R;
import utils.GlideUtils;

public class IMRoomMeberAdapter extends BaseQuickAdapter<ChatRoomMemberBean.mlist, BaseViewHolder> {
    private Context context;

    public IMRoomMeberAdapter(Context context, int layoutResId, @Nullable List<ChatRoomMemberBean.mlist> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ChatRoomMemberBean.mlist item) {
        GlideUtils.loadImageViewHeadphotoLoding(context, item.head_image, (ImageView) helper.getView(R.id.cimg_headimg));
        helper.setText(R.id.tv_name, item.student_name);
        TextView tv = helper.getView(R.id.tv_name);
        if(item.chatRoomMember!=null){
            tv.setTextColor(Color.BLACK);
        }else {
            tv.setTextColor(Color.GRAY);
        }
//        for (ChatRoomMember chatRoomMember : chatRoomMembers) {
//            TextView tv = helper.getView(R.id.tv_name);
//            //判断是否在线
//            if (item.accid == chatRoomMember.getAccount()) {
//                tv.setTextColor(Color.BLACK);
//            } else {
//                tv.setTextColor(Color.GRAY);
//            }
//        }
    }
}
